package com.whp.spi0923;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;

/**
 * @author wanghp
 * @version 1.0
 * @date 2020/9/23 11:42
 */

public class DubboConsumerAdapterSupport implements BeanDefinitionRegistryPostProcessor, InitializingBean{
	@Override
	public void afterPropertiesSet() throws Exception {

	}

	@Override
	public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
		String[] beanDefinitionNames = registry.getBeanDefinitionNames();
		for (String beanDefinitionName : beanDefinitionNames) {
			BeanDefinition beanDefinition = registry.getBeanDefinition(beanDefinitionName);
			//拿到dubbo reference 对应的Bean
			String beanClassName = beanDefinition.getBeanClassName();

			//将该beanDefinition从spring移除并放入自己的动态代理类
		}
	}

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

	}
}
